package com.zzptc.myk.shop.dao;

import com.zzptc.myk.shop.db.DBI;
import com.zzptc.myk.shop.db.DBImpl;
import com.zzptc.myk.shop.vo.UserFoot;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Date;

public class UserFootDaoImpl implements UserFootDaoI {
    @Override
    public int insert(UserFoot uf) throws SQLException {
        DBI db = new DBImpl();
        int flag = 0;
        Connection connection = db.getConn();
        String sql = "insert into taotaobuy_userfoot(to_user_id,tpc_id,tpc_parent_id,tuf_create_time,tp_id) values(?,?,?,?,?)";
        PreparedStatement ps = connection.prepareStatement(sql);
        ps.setObject(1,uf.getuId());
        ps.setObject(2,uf.getPcId());
        ps.setObject(3,uf.getPcPId());
        ps.setObject(4,new Date());
        ps.setObject(5,uf.getpId());
        flag = ps.executeUpdate();
        ps.close();
        db.closeConn();
        return flag;
    }


}
